// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-12-3

#ifndef __UI_ATTRIBVIEW_H_COMMON_SVR_BASE__
#define __UI_ATTRIBVIEW_H_COMMON_SVR_BASE__

#pragma once

#include <common/ui/listview.h>


class CJoyServerWnd;

namespace JoyServer
{
class CJoyServer;
}
using namespace JoyServer;

class CJoyAttribViewItem : public CJoyListViewItem
{
protected:

    virtual void CM_Draw(Graphics& graph);

public:
    CStringW    m_attribName;
    CStringW    m_attribValue;

    virtual void OnStart(CJoyServer* pServer);
    virtual void OnStop();
public:
    CJoyAttribViewItem();
    virtual ~CJoyAttribViewItem();

    virtual void UpdateAttrib();
    virtual void UpdateAttrib(CJoyServer* pServer);

    CJoyServerWnd* GetServerWnd();
};

class CJoyAttribViewField : public CJoyListViewField
{
public:
    virtual void CM_Draw(Graphics& graph);
};

namespace JoyAttribViewFields
{
class AttribNameField;
class AttribValueField;
};

class CJoyAttribView : public CJoyListView
{
	DECLARE_DYNAMIC(CJoyAttribView)
public:
    JoyAttribViewFields::AttribNameField*   m_attribNameField;
    JoyAttribViewFields::AttribValueField*  m_attribValueField;

    CJoyServerWnd*  m_svrWnd;

    void UpdateAllAttrib();
	void UpdateAllNewRoom();//-----------------------------------------------------updateNewRoom

public:
    CJoyAttribView();
    virtual ~CJoyAttribView();

    virtual void Start();
    virtual void Stop();
public:
    DECLARE_MESSAGE_MAP()
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    afx_msg void OnDestroy();
    afx_msg void OnTimer(UINT nIDEvent);
};

inline CJoyServerWnd* CJoyAttribViewItem::GetServerWnd()
{
    return ((CJoyAttribView*)this->m_listView)->m_svrWnd;
}

#endif  // __UI_ATTRIBVIEW_H_COMMON_SVR_BASE__